﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;

namespace Justin.Utility
{
    public static class Extensions
    {

        public static T GetValue<T>(this XmlNode node, string attributeName)
        {
            string value = "";
            if (node != null && node.Attributes[attributeName] != null)
                value = node.Attributes[attributeName].Value;
            try
            {
                return (T)Convert.ChangeType(value, typeof(T));
            }
            catch
            {
                return default(T);
            }
        }
    }
}
